package cp1300a2;

import java.awt.*;
import java.awt.event.*;
import javax.swing.JComboBox;

public class GUI extends Frame implements WindowListener,ActionListener {
	TextField text = new TextField(20);
	Button b;
        String[] menu_1_value = { "1", "2", "3" };
        String[] menu_2_value = { "1", "2", "3", "4" };
        String[] menu_3_value = { "0", "0.5", "1" };
        String[] menu_4_value = { "0", "0.5", "1" };


        JComboBox menu_1 = new JComboBox(menu_1_value);
        JComboBox menu_2 = new JComboBox(menu_2_value);
        JComboBox menu_3 = new JComboBox(menu_3_value);
        JComboBox menu_4 = new JComboBox(menu_4_value);

	private int numClicks = 0;

	public static void main(String[] args) {
		GUI myWindow = new GUI("My first window");
		myWindow.setSize(350,100);
		myWindow.setVisible(true);
	}

	public GUI(String title) {

		super(title);
		setLayout(new FlowLayout());
		addWindowListener(this);
		b = new Button("Click me");
		add(b);
		add(text);
		b.addActionListener(this);
                //Create the combo box, select item at index 4.
                //Indices start at 0, so 4 specifies the pig.

                menu_1.setSelectedIndex(1);
                //petList.addActionListener(this);
                add(menu_1);
                add(menu_2);
                add(menu_3);
                add(menu_4);
                //petList.addActionListener(this);

	}

	public void actionPerformed(ActionEvent e) {
            numClicks++;
            text.setText("Button Clicked " + numClicks + " times");
            //Object obj = petList.getSelectedItem(); // item1
            text.setText((String) menu_1.getSelectedItem());

	}

	public void windowClosing(WindowEvent e) {
		dispose();
		System.exit(0);
	}

	public void windowOpened(WindowEvent e) {}
	public void windowActivated(WindowEvent e) {}
	public void windowIconified(WindowEvent e) {}
	public void windowDeiconified(WindowEvent e) {}
	public void windowDeactivated(WindowEvent e) {}
	public void windowClosed(WindowEvent e) {}

}

